找传奇、传世资源到传世资源站!
Java 正文

个人财务管理系统源码(无需mysql数据库,本示例基于csv文件做数据源)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

用户注册、登录、修改密码
  (1)分类管理(收入分类:工资、奖金、兼职。。。支出分类:生活用品,餐饮,旅游,社交。。。)
  (2)收入录入
  (3)支出录入
  (4)收支情况查询
  (5)收支情况删除 
  (6)统计(按年、月、收入分类、支出分类统计)
       要求:能获知每月收入多少,支出多少
             能获知每月在生活用品、餐饮、旅游、社交等各支出多少
       
  (7)退出from clipboard from clipboard from clipboard
from clipboard package finance.data;

import java.io.IOException;
import java.util.ArrayList;

import finance.getset.Users;
import finance.records.UsersRecord;

public class UsersDao {

public void add(String username, String password) throws IOException {
ArrayList<Users> list = query();
Users a = new Users();
a.setUsername(username);
a.setPassword(password);
list.add(a);
UsersRecord ur = new UsersRecord();
ur.set(list);

}

public ArrayList<Users> query() {
UsersRecord ur = new UsersRecord();
ArrayList<Users> list = new ArrayList<Users>();
try {
list = ur.get();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}

public void correct(String username, String password) throws IOException {
ArrayList<Users> list = query();
for (int i = 0; i < list.size(); i ) {
if (list.get(i).getUsername().equals(username)) {
list.get(i).setPassword(password);
break;
}
}
UsersRecord ur = new UsersRecord();
ur.set(list);

}

}
package finance.records;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;

import finance.getset.Users;
import finance.getset.UsersItem;

public class Record {

public void set(ArrayList<UsersItem> list) throws IOException {
// TODO Auto-generated method stub
FileWriter Writer = new FileWriter("Record.csv");
BufferedWriter wr = new BufferedWriter(Writer);
for (int i = 0; i < list.size(); i ) {
wr.write(list.get(i).getNumber() ","   list.get(i).getUsername() "," list.get(i).getYear()
"," list.get(i).getMonth() "," list.get(i).getDay() "," list.get(i).getInput_type() "," list.get(i).getInput_sum()
"," list.get(i).getOutput_type() "," list.get(i).getOutput_sum());
wr.newLine();
}
wr.close();
}

public ArrayList<UsersItem> get() throws IOException {
// TODO Auto-generated method stub
FileReader reader = new FileReader("Record.csv");
BufferedReader br = new BufferedReader(reader);
String ch;
ArrayList<UsersItem> list = new ArrayList<UsersItem>();
int j=0;
while ((ch = br.readLine()) != null) {

UsersItem a = new UsersItem();
String[] ch2 = ch.toString().split(",");

a.setNumber(Integer.valueOf(ch2[0]));
a.setUsername(ch2[1]);
a.setYear(ch2[2]);
a.setMonth(Integer.valueOf(ch2[3]));
a.setDay(Integer.valueOf(ch2[4]));
a.setInput_type(ch2[5]);
a.setInput_sum(Integer.valueOf(ch2[6]));
a.setOutput_type(ch2[7]);
a.setOutput_sum(Integer.valueOf(ch2[8]));
list.add(a);

}
br.close();
return list;
}

}

package finance.records;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;

import finance.getset.Users;
import finance.getset.UsersItem;

import java.util.*;

public class UsersRecord {

public void set(ArrayList<Users> list) throws IOException {
// TODO Auto-generated method stub
FileWriter Writer = new FileWriter("Users.csv");
BufferedWriter wr = new BufferedWriter(Writer);
for (int i = 0; i < list.size(); i ) {

wr.write(list.get(i).getUsername() "," list.get(i).getPassword());
wr.newLine();
}
wr.close();
}

public ArrayList<Users> get() throws IOException {
// TODO Auto-generated method stub
FileReader reader = new FileReader("Users.csv");
BufferedReader br = new BufferedReader(reader);
String ch;
ArrayList<Users> list = new ArrayList<Users>();

while ((ch = br.readLine()) != null) {

Users a = new Users();
String[] ch2 = ch.toString().split(",");
a.setUsername(ch2[0]);
a.setPassword(ch2[1]);
list.add(a);

}
br.close();
return list;
}

}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复